﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.ProgressBar;

namespace 玩具商城管理系统.znew
{
    public partial class Ncommodity : Form
    {
        public Ncommodity()
        {
            InitializeComponent();
        }

        private void Ncommodity_Load(object sender, EventArgs e)
        {
            label5.Text =login.username;
            DB.GetCn();
            string str = "select * from client where client_name='" + login.username + "'";
            SqlCommand cmd = new SqlCommand(str, DB.cn);
            SqlDataReader rdr = cmd.ExecuteReader();
            while (rdr.Read())
            {
                string sdr1 = "";
                string sdr2 = "";
                string sdr3 = "";
                string sdr4 = "";
                string sdr = (string)rdr[8];
                if (!rdr.IsDBNull(1)) { sdr1 = (string)rdr[1]; }
                else { sdr1 = "无"; }
                if (!rdr.IsDBNull(2)) { sdr2 = (string)rdr[2]; }
                else { sdr2 = "无"; }
                if (!rdr.IsDBNull(7)) { sdr3 = (string)rdr[7]; }
                else { sdr3 = "无"; }
                if (!rdr.IsDBNull(9)) { sdr4 =rdr[9].ToString(); }
                else { sdr4 = "0"; }

                double countValue = double.Parse(sdr4);
                if (sdr == "初级用户")
                {
                
                    label6.Text = "LV2-翡翠";
                }
               else if (sdr == "高级用户")
                {
                    
                    label6.Text = "LV3-莲华";
                }
                else
                {
                
                    label6.Text = "LV1-曜石";
                }
                label9.Text = sdr1;
                label10.Text = sdr2;
                label13.Text = sdr3;
                label15.Text = countValue.ToString();
            }
            rdr.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            NorderT ot=new NorderT();
            ot.ShowDialog();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Tshopcar sp =new Tshopcar();
            sp.ShowDialog();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void label6_Click(object sender, EventArgs e)
        {

        }

        private void label4_Click(object sender, EventArgs e)
        {
            label3.Visible = true;
        }

        private void label4_MouseMove(object sender, MouseEventArgs e)
        {
            label3.Visible = true;
        }

        private void label4_MouseLeave(object sender, EventArgs e)
        {
            label3.Visible=false;
        }

        private void button4_Click(object sender, EventArgs e)
        {
            Ninformation ni = new Ninformation();
            ni.ShowDialog();
        }
    }
}
